<?php
/**
 * <https://y.st./>
 * Copyright © 2016 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'title' => 'When developers mark a property (or method) as <code>private</code>, they do so for a reason!',
	'body' => <<<END
<img src="/img/CC_BY-SA_4.0/y.st./weblog/2016/11/06.jpg" alt="Tom and my mother" class="weblog-header-image" width="811" height="480" />
<p>
	Current countdowns:
</p>
<ul>
	<li>234 scheme-specific $a[URI]-parsing classes to write and add to <a href="https://git.vola7ileiax4ueow.onion/y.st./include.d/releases">include.d</a></li>
	<li>1 free elective left in my associate degree program</li>
	<li>4 free electives left in my bachelor degree program</li>
</ul>
<p>
	Topics for essays that I want to write outside of school:
</p>
<ul>
<li>How the $a[GFDL] isn&apos;t a free license, and is effectively nonfree even when invariant sections aren&apos;t used</li>
<li>How the telephone number system is screwy</li>
<li>How postpaid mobile plans are bad for customers</li>
<li>How connections using &quot;untrusted&quot; $a[TLS] certificates are more trustworthy than connections without any $a[TLS] certificate at all</li>
<li>The importance of free software</li>
<li>The importance of free media</li>
</ul>
<p>
	I modified my base 32 exception code encoder to use standard base 32 instead of my custom character set.
	This meant removing all non-letter characters and replacing them with a partial set of digits.
	Originally, I used various non-alphanumeric symbols because I felt (and still do feel) that a partial set of digits isn&apos;t very useful.
	A <strong>*full*</strong> set of digits would come in handy, but having several digits missing makes all the remaining digits less useful.
	However, standards are important, so I&apos;ve cleaned up my code.
	For a bit, I again contemplated using 64-bit exception codes instead of my current 32-bit codes.
	With 64-bit exception codes, I could have full Unicode support with 8-byte codes.
	I&apos;d have characters in the $a[ASCII] range, or less characters when using multi-byte Unicode code points.
	That said, exception codes are stored as integers.
	$a[PHP] integer size is platform-dependent, and $a[PHP] doesn&apos;t support 64-bit integers on 32-bit platforms.
	I&apos;m on a 64-bit system, but other users of my code might not always be.
	With only 32 bits, having a decent character set has to be weighed against having a decent string length.
	The larger the character set used, the shorter the string encoded has to be.
	The best options that I can come up with are strings made up of five six-bit characters or six five-bit characters.
	Something in between is possible, but too difficult to work with to be worth it.
	Originally, I actually tried to get something in the middle, but the encoding and decoding was taking a lot of code, didn&apos;t seem easy to maintain, and was difficult to get right.
	I ended up scrapping that idea in favor of using whole numbers of bits for each encoded character.
	Both five-character strings made up of six-bit characters and six-character strings made up of five-bit characters use up only thirty bits, leaving (on 32-bit systems) two bits left over.
	I ended up using one bit as a flag, toggling between five-bit character mode and six-bit character mode, so either can be used whenever most useful.
	Not only does this offer more options, it makes usable half of the 32-bit integer range that would otherwise remain untouched.
	I use the other spare bit as a flag to divide the exception code space in half, using half for reusable code and half for single-project code.
	If I was working with 64-bit integers, I&apos;d lose both of these flags, but one would be useless anyway and the other would be easy to live without.
	I considered setting up a method of providing a 32-bit exception code for 32-bit platforms and a 64-bit exception code for 64-bit platforms, passing both codes into the exception constructor and allowing the constructor to figure out which to use based on the platform, but it seemed to be too difficult to maintain.
	I&apos;d need a list of all exception codes for both integer sizes, making sure that both lists didn&apos;t contain duplicates.
	Having a single list takes half the effort to maintain while not really providing much less value.
</p>
<p>
	I took a look at the <code>cid:</code> and <code>mid:</code> scheme&apos;s scheme-specific syntax, but I&apos;ve decided to put off building classes for those schemes just yet.
	The syntax is a bit complicated due to the fact that the $a[URI]s use $a[URI]-encoded versions of data that fits an entirely-different syntax.
	Validating data would require validation rules based on what the data decodes to.
	Come to think of it, as I write this, it becomes obvious what the correct way to do this is.
	I must decode the data, then validate it.
	That would be <strong>*so*</strong> much easier than attempting to validate the encoded version.
	I might work on that tomorrow.
	I also completed work on the <code>coaps:</code>- and <code>coap:</code>-scheme classes, but those were on the other end of the effort spectrum.
	They took almost no work to set up.
</p>
<p>
	After setting up a couple of simple scheme classes, I build some code that counts how many schemes I&apos;ve finished with and home many more I have left to complete.
	I&apos;m tired of trying to track that myself, having to remember which new scheme classes I&apos;ve accounted for yet and which I haven&apos;t.
	I also built an exception code tracker and documenter into my debug scripts so I can just add exceptions wherever I need them and not worry about taking notes.
</p>
<p>
	I had a flash of inspiration on how to build the function that I was working on about five months ago that tries to figure out which library files are used by a given script.
	The purpose of this was to make it easy to include only part of include.d within a project instead of putting include.d as a whole in the <code>include_path</code> and allowing all projects to access its features.
	While this isn&apos;t the preferred way of using include.d, it might be useful to developers that don&apos;t want to rely on external dependencies.
	Previously, I was tokenizing the contents of scripts and trying to make inferences based on certain tokens that weren&apos;t even directly related to the information that I was looking for.
	This time, however, started out with instead using a custom autoloder for classes and a custom function for <code>require()</code>ing function and constant files.
	These two functions could record the files that they import, then report them once the script terminated.
	By actually running the script, I&apos;d get all the information that I needed about what library files were actually used! The main issue with this is that branched script flow and varied input might result in some classes only sometimes being used and therefore potentially not finding their way onto the list of files used in a given run.
	The other issue is that while the custom autoloader would be easy to replace with one line change, the function for loading functions and constants would be used many times, so it might be better to have that function act differently depending on some sort of flag.
	Then again, because functions and constants need to be manually included, it&apos;s probably best to simply include them from the top of the main script.
	Reading a list of needed files from there would be no problem when trying to figure out which parts of include.d to use.
	In any case though, I came up with a better idea, using information that $a[PHP] itself already has.
	I remembered that <a href="https://secure.php.net./manual/en/function.get-defined-constants.php"><code>\\get_defined_constants()</code></a> not only reports what constants have been defined, but can sort user-defined constants from language-defined constants.
	Was the same functionality available for classes and functions? Maybe not.
	There&apos;s a <a href="https://secure.php.net./manual/en/function.get-defined-functions.php"><code>\\get_defined_functions()</code></a> function and a <a href="https://secure.php.net./manual/en/function.get-declared-classes.php"><code>\\get_defined_classes()</code></a> function, but neither is able to sort user-defined constructs from system-defined constructs.
	(It&apos;s worth noting that <code>\\get_defined_classes()</code> won&apos;t return all classes, and <a href="https://secure.php.net./manual/en/function.get-declared-interfaces.php"><code>\\get_defined_interfaces()</code></a> and <a href="https://secure.php.net./manual/en/function.get-declared-traits.php"><code>\\get_defined_traits()</code></a> are needed to get the rest.) I started looking into a way to tell if a given function or class is user-defined or language-defined, figuring that I could simply iterate over the output of the get_defined_*() functions, but instead of answers to that, I found something shocking.
</p>
<p>
	As it turns out, <a href="https://ocramius.github.io./blog/accessing-private-php-class-members-without-reflection/">private structures such as private object properties aren&apos;t really private</a>.
	Using <a href="https://secure.php.net./manual/en/closure.bindto.php"><code>\\Closure::bindTo()</code></a>, functions can be injected into $a[API]s that they don&apos;t belong in, allowing access to private areas.
	I don&apos;t mind allowing read access, but this allows write access to.
	It undermines the concept of private properties and methods in every way.
	All of the data-validation checks that I&apos;ve been writing into my $a[URI]-processing $a[API] are for nothing, and that&apos;s just the example that affects me personally.
	Defining a class is like defining a new data type.
	The class is able to insure that certain rules are followed so that the data fits into the appropriate data domain.
	When validity checks are undermined, the class is no longer able to insure that instance objects will behave as intended.
	Type hinting in function and method declarations no longer have their full meaning.
	These functions and methods expect well-behaved objects, but that&apos;s not what they&apos;re guaranteed to get any more.
	Likewise, the <code>instanceof</code> key word is no longer able to properly check an object for its behavior.
	I did a little experiment to see if the problem&apos;s impact was what I thought it was, and indeed, it is that bad.
	Using this closure method, I was able to unset the scheme of a $a[URI] object, a feat that I&apos;d programmed to be impossible, due to the fact that all $a[URI]s are required to have a scheme.
	This broke the <code>\\st\\y\\uri::__tostring()</code> method, causing it to spit out errors instead of returning the string representation of the $a[URI].
	When developers mark a property (or method) as <code>private</code>, they do so for a reason!
</p>
<p>
	I still only have one work uniform.
	Washing one day&apos;s worth of clothing is far too expensive at a laundromat, so I just decided to start washing my work uniform by hand in the bath tub.
	It&apos;s not the most elegant solution, but it&apos;ll have to do for now.
</p>
<p>
	It seems that my mother somehow decided that I wanted to visit a <a href="https://en.wikipedia.org./wiki/Bird_of_prey">raptor</a> center.
	I have no idea where they got this idea.
	I remember that years ago, my mother gave me an invitation and a flier for a raptor center, but I ignored it because my mother&apos;s always been very bad at gift-giving.
	At that time, I thought htat visiting a bunch of caged birds was a boring way to spend the day.
	Now, in addition to finding it boring, I feel that it&apos;s decidedly non-vegan and going is a horrid waste of fossil fuels.
	There is just nothing appealing about this prospect.
	My mother insists that at some point, I expressed an interest in this, but I&apos;m not sure why I would do that.
	My best guess is that my mother&apos;s memory is failing them again and that someone else was the one to express such an interest.
	Either that, or my mother vastly misinterpreted what I had said.
	After all, my mother did think that I somehow wanted a creepy pedometer that sends heart rate and step counts to a company&apos;s server and requires a proprietary operating system to use, despite the fact that I repeatedly told them that I didn&apos;t want one.
	I tried not to be negative about the fact that they were using one, but every time that they brought up the idea of <strong>*me*</strong> using one, I always declined.
</p>
<p>
	A chunk of the day was used moving things to the storage unit, as well as removing things from the unit that my moter wants in their classroom.
	Some of it is stuff that I legitimately think tat they want there, but some of it is being moved to the classroom just to get it out of the way.
	It&apos;s teaching-related stuff, but not stuff that they&apos;d have otherwise been interested in using this school year.
</p>
<p>
	Having concluded our work for the day, we went to visit a friend of my mother.
	My mother&apos;s friend Tom has a crush on them, which my mother isn&apos;t thrilled with.
	Tom won&apos;t accept the fact that my mother isn&apos;t interested, so my mother doesn&apos;t like to be alone with them.
	That&apos;s why I was there.
	We spent some time talking, then went home.
</p>
<p>
	My mother started cooking up some potatoes for their own dinner tonight and their breakfast tomorrow, but just as I walked into the room, the pan fell to the floor and it all went to waste.
	At first, my mother thought that I&apos;d bumped it, but I wasn&apos;t anywhere near it yet; I was too far away to even catch it as it fell, though I did try.
	It was highly frustrating though.
	They were too tired to cook it again from the start.
	My mother doesn&apos;t cook very often, then the one time that they <strong>*did*</strong> cook, they didn&apos;t even get to enjoy their meal.
</p>
<p>
	Today was the final day of late course registrations.
	My options still hadn&apos;t opened up, so I was still unable to sort out my course situation.
	If the school staff were already planning to step in because of some Yst-is-a-newbie thing, everything might still be on track.
	Maybe they set their system to treat all new students this way because of poor programming on the part of their website developers.
	Hopefully I&apos;ll end up in the correct courses by Wednesday, when my next term starts.
	I can&apos;t help but feel that a particular assignment in <span title="Online Education Strategies">UNIV 1001</span> might be relevant.
	We were required to tell which courses we planned to take next term and explain our choices.
	What if this assignment was really a way to find out what courses to manually put us in next term?
</p>
<p>
	Google decided to throw a fit about my account again.
	This time though, they allowed my to unlock it using any $a[SMS]- or voice-enabled telephone number.
	This is just sheer lunacy.
	I borrowed Vanessa&apos;s mobile for that, but what was even the point from Google&apos;s perspective? They didn&apos;t require me to use a number that was associated with my account, which means that this was <strong>*in no way*</strong> a attempt at a security measure.
	Google was just being a pain as always for no good reason.
	Once I&apos;m done with schooling, have found a reasonably-paying job, and moved out on my own, I can be done with Google forever.
	I only need this Google account so that I can use Google Voice to get a stable $a[SMS]-compatible telephone number for my mother to reach me at because my mother won&apos;t use basic email to reach me and can&apos;t stand that my number frequently changes when I change mobile plans.
	When I move out, my mother can either reach me via email like everyone else of they can choose some other non-telephone method of contact.
</p>
<p>
	My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
</p>
END
);
